package org.example.game.weekly.game414;

import java.util.Arrays;
import java.util.List;

/**
 * @Description: TODO
 * @Author wyatt
 * @Data 2024/08/03 20:46
 */
public class Solution003 {

    public static void main(String[] args) {
        List<Integer> nums = Arrays.asList(1,3);
        System.out.println(new Solution003().findMaximumScore(nums));
    }


    //从后往前找 max
    //最后只能调到 n-1
    public long findMaximumScore(List<Integer> nums) {
        long sum = 0;
        int x = nums.get(0);
        for (int i = 0; i < nums.size()-1; i++) {
            x = Math.max(x, nums.get(i));
            sum+=x;
        }
        return sum;
    }


}
